<template>
	<view class="box-content">
		<view class="top-shop-name">
			<view class="header flex_box">
				<image :src="shopInfo.logo && shopInfo.logo.image" mode="aspectFill"></image>
				<text>{{shopInfo.store_name}}</text>
			</view>
			<view class="flex_box" style="align-items: center;">
				<uni-icons @click="$util.toUrl('/pages/message/message')" type="chat-filled" color="#333" :size="26"></uni-icons>
				<image @click="callphone" src="https://qiniu-cdn.maeiyun.com/imgs/shangjia/i11.png" class="image">
				</image>
				<uni-icons type="gear-filled" color="#333" :size="26"
					@click="$util.toUrl('/pages/setting/setting')"></uni-icons>
			</view>
		</view>
		<view class="box-type">
			<view class="title" @click="toOrder(0)">
				订单管理
				<uni-icons type="right" size="18"></uni-icons>
			</view>
			<view class="type-list">
				<uni-badge size="small" :text="statistics.daijiedan_num" absolute="rightTop">
					<view @click="toOrder(1)">
						<image src="https://qiniu-cdn.maeiyun.com/imgs/shangjia/jiedan.png"></image>
						<view>待接单</view>
					</view>
				</uni-badge>
				<uni-badge size="small" :text="statistics.daifuwu_num" absolute="rightTop">
					<view @click="toOrder(2)">
						<image src="https://qiniu-cdn.maeiyun.com/imgs/shangjia/i13.png"></image>
						<view>待服务</view>
					</view>
				</uni-badge>
				<uni-badge size="small" :text="0" absolute="rightTop">
					<view @click="toOrder(3)">
						<image src="https://qiniu-cdn.maeiyun.com/imgs/shangjia/i12.png"></image>
						<view>已完成</view>
					</view>
				</uni-badge>
				<uni-badge size="small" :text="statistics.tksh_num" absolute="rightTop">
					<view @click="toOrder(4)">
						<image src="https://qiniu-cdn.maeiyun.com/imgs/shangjia/i10.png"></image>
						<view>退款/投诉</view>
					</view>
				</uni-badge>
			</view>
		</view>
		<view class="box-type">
			<view class="title" style="border: 0;">
				技师管理
			</view>
			<view class="type-list-menu">
				<navigator hover-class="none" url="/pages/technicianAudit/technicianAudit" class="item-menu flex_c flex_c">
					<uni-badge size="small" :text="statistics.check_team_num" absolute="rightTop">
						<image src="/static/img/index_icon_1.png"></image>
						<view>审核技师</view>
					</uni-badge>
				</navigator>
				<navigator hover-class="none" url="/pages/technicianTeam/technicianTeam" class="item-menu flex_c">
					<uni-badge size="small" :text="statistics.team_num" absolute="rightTop">
						<image src="/static/img/index_icon_2.png"></image>
						<view>技师团队</view>
					</uni-badge>
				</navigator>
				<navigator hover-class="none" url="/pages/technicianWithdraw/technicianWithdraw" class="item-menu flex_c">
					<uni-badge size="small" :text="statistics.withdraw_num" absolute="rightTop">
						<image src="/static/img/index_icon_4.png"></image>
						<view>技师提现</view>
					</uni-badge>
				</navigator>
			</view>
		</view>
		<view class="box-type">
			<view class="title" style="border: 0;">
				综合管理
			</view>
			<view class="type-list-menu">
				<view class="item-menu flex_c" @click="$util.toUrl('/pages/manage/evaluate/evaluate')">
					<image src="/static/img/index_icon_5.png"></image>
					<view>用户评价</view>
				</view>
				<view class="item-menu flex_c" @click="$util.toUrl('/pages/manage/service/list')">
					<image src="/static/img/index_icon_6.png"></image>
					<view>服务管理</view>
				</view>
				<view class="item-menu flex_c" @click="$util.toUrl('/pages/manage/store/store')">
					<image src="/static/img/index_icon_7.png"></image>
					<view>门店管理</view>
				</view>
				<view class="item-menu flex_c" @click="$util.toUrl('/pages/manage/statistics/statistics')">
					<image src="/static/img/index_icon_8.png"></image>
					<view>商家统计</view>
				</view>
				<view class="item-menu flex_c" style="margin-top: 30rpx;"
					@click="$util.toUrl('/pages/manage/wallet/wallet')">
					<image src="/static/img/index_icon_9.png"></image>
					<view>企业钱包</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopInfo: {},
				statistics: {}	
			}
		},
		onLoad() {
		},
		onShow() {
			let token = uni.getStorageSync('token')
			let shopid = uni.getStorageSync('shopid')
			if (shopid && token) {
				this.getShopInfo(shopid)
			} else {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			}
			this.gettongji()
		},
		methods: {
			gettongji() {
				var that = this
				this.request.httpTokenRequest({
					url: "store.store/getStoreData",
					method: "POST"
				}, {}).then(function(data) {
					if (data.code == 0) {
						that.statistics = data.data
					} else {

					}
				})
			},
			toOrder(type) {
				if(type == 4) {
					uni.navigateTo({
						url: '/pages/order/afterSale'
					})
				}else{
					uni.navigateTo({
						url: '/pages/order/order?type='+type
					})
				} 
			},
			callphone() {
				var that = this
				this.request.httpTokenRequest({
					url: "index/getConfig?type=website&key=kefu_mobile",
					method: "get"
				}, {}).then(function(data) {
					if (data.code == 0) {
						that.$util.makeCall(data.data.value)
					} else {

					}
				})
			},
			getShopInfo(id) {
				var that = this
				this.request.httpTokenRequest({
					url: "store.store/getStoreInfo",
					method: "get"
				}, {
					id: id
				}).then(function(data) {
					if (data.code == 0) {
						that.shopInfo = data.data
						uni.setStorageSync('store',data.data)
					} else {
						that.isSend = false
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.top-shop-name {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-top: calc(var(--status-bar-height) + 10px);
		padding-bottom: 24rpx;

		.image {
			width: 34rpx;
			height: 34rpx;
			margin: 0 20rpx;
		}

		.header {
			align-items: center;

			text {
				font-size: 34rpx;
				font-weight: 600;
				color: #08090A;
				line-height: 48rpx;
			}

			image {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}

		}
	}
	//
	.box-type {
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 30rpx;
		margin-bottom: 30rpx;

		.title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			font-weight: 600;
			color: #333333;
			border-bottom: 1rpx solid #D5D5D5;
			padding-bottom: 30rpx;
		}

		.type-list {
			display: flex;
			align-items: center;
			justify-content: space-around;
			font-size: 26rpx;
			font-weight: 400;
			color: #333333;
			line-height: 37rpx;
			padding-top: 30rpx;
			text-align: center;

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}

		.type-list-menu {
			display: flex;
			align-items: center;
			flex-wrap: wrap;

			.item-menu {
				font-size: 26rpx;
				width: 25%;
				font-weight: 400;
				color: #333333;
				line-height: 37rpx;
				text-align: center;
			}

			image {
				width: 78rpx;
				height: 78rpx;
				margin-bottom: 13rpx;
			}
		}
	}
</style>